#!/usr/bin/python
# -*- coding: UTF-8 -*-
import tkinter

from utils.JsonUtils import JsonUtils
from utils.WindowUtils import WindowUtils

class BaseSubWindow(tkinter.Toplevel):
    def __init__(self,root,width=500,height=300):
        super(BaseSubWindow, self).__init__(root)
        WindowUtils.center_window(self, width, height)

    def getWidth(self):
        self.update()
        return self.winfo_width()

    def getHeight(self):
        self.update()
        return self.winfo_height()

    def getSettings(self):
        file = "%s/%s" % (self.currentDir(),'settings.json')
        return JsonUtils.toJSON(JsonUtils.loadJsonFromFile(file))

    def currentDir(self):
        return ''